Skip to content

Conversation

@Tseian
Copy link

@Tseian Tseian commented Dec 24, 2025

Issue

#57045

Description

Improves the error message when process.cwd() failed by adding prefix err message 'process.cwd failed with error' if call uv_cwd failed

Before

Error: ENOENT: no such file or directory, uv_cwd

After

ENOENT: process.cwd failed with error no such file or directory, the current working directory was likely removed without changing the working directory, uv_cwd

Changes

  • src/node_process_methods.cc

Test

  • test/known_issues/test-cwd-enoent-file.js
  • test/parallel/test-cwd-enoent-improved-message.js

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Dec 24, 2025
@codecov
Copy link

codecov bot commented Dec 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.54%. Comparing base (732ab9d) to head (95968df).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #61164      +/-   ##
==========================================
- Coverage   92.22%   88.54%   -3.68%     
==========================================
  Files         343      703     +360     
  Lines      139240   208603   +69363     
  Branches    22253    40222   +17969     
==========================================
+ Hits       128413   184708   +56295     
- Misses      10600    15910    +5310     
- Partials      227     7985    +7758     
Files with missing lines Coverage Δ
src/node_process_methods.cc 88.86% <100.00%> (ø)

... and 477 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Tseian
Copy link
Author

Tseian commented Dec 24, 2025

@theanarkh @joyeecheung Please trigger the ci to check again.

@Tseian
Copy link
Author

Tseian commented Dec 25, 2025

@joyeecheung @legendecas @Qard @theanarkh Pls code review this pr

@Qard
Copy link
Member

Qard commented Dec 25, 2025

My thinking with reporting the issue initially was that we could provide a bit more expanded context explaining what the cause could be, like stating that the current working directory was likely removed without changing the working directory to something else. It's already I think obvious enough that the error is coming from a cwd() call. What's not obvious is why.

@Tseian
Copy link
Author

Tseian commented Dec 25, 2025

My thinking with reporting the issue initially was that we could provide a bit more expanded context explaining what the cause could be, like stating that the current working directory was likely removed without changing the working directory to something else. It's already I think obvious enough that the error is coming from a cwd() call. What's not obvious is why.

@Qard So, would changing the error message to "ENOENT: process.cwd failed with error no such file or directory, the current working directory was likely removed without changing the working directory, uv_cwd" achieve it?

@Qard
Copy link
Member

Qard commented Dec 25, 2025

That sounds reasonable to me. 🙂

@Tseian
Copy link
Author

Tseian commented Dec 25, 2025

That sounds reasonable to me. 🙂

Got it. I will commit it soon.

@Tseian
Copy link
Author

Tseian commented Dec 26, 2025

@Qard Hi, I have committed it. Please have a code review for it, and if there is no issue please trigger the CI to check again.

@Tseian
Copy link
Author

Tseian commented Dec 27, 2025

@Qard If you have time, please help trigger a CI to check and review the pr. Thank you very much😊.

@Qard Qard added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 27, 2025
@github-actions github-actions bot added request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. and removed request-ci Add this label to start a Jenkins CI on a PR. labels Dec 27, 2025
@github-actions
Copy link
Contributor

Failed to start CI
   ⚠  Commits were pushed since the last approving review:
   ⚠  - process: improve process.cwd() error message
   ⚠  - process: add notice message when process.cwd() failed.
   ⚠  - process: fix cpp format issue
   ✘  Refusing to run CI on potentially unsafe PR
https://github.com/nodejs/node/actions/runs/20535988465

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants